package abba;

import java.util.Arrays;

public class WordsWithSameLetters {

	void calculateLetters(String word1, String word2) {
		if (word1 == null || word2 == null){
			throw new IllegalArgumentException("Non-existent word!");
		}
		if ( word1.length() != word2.length())
			System.out.println("words not interesting");
		for (int i = 0; i < word1.length(); i++ ) {
			
		}
	}
	
	static String sortLetters(String word) {
		if (word == null) {
			throw new IllegalArgumentException("Non-existent word!");
		}
		char temp = ' ';
		String newWord = word.toLowerCase();
		char[] wordArray = newWord.toCharArray();
		Arrays.sort(wordArray);
		for (int i = 0; i < wordArray.length; i ++) {
			System.out.println(wordArray[i]);
		}
		newWord = wordArray.toString();		
		return newWord;
	}
	
	public static void main(String[] args) {
		
		sortLetters("radar");

	}

}
